package com.dongdongshop.serviceImpl;
import com.dongdongshop.mapper.TbContentMapper;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.service.TbContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbContentServiceImpl implements TbContentService {
    @Autowired
    private TbContentMapper tbContentMapper;
    @Override
    public List<TbContent> selectByCid(Long id) {
         List<TbContent> tbContent =  tbContentMapper.selectByCid(id);
        return tbContent;
    }

    @Override
    public List<TbContent> selectByAll() {
        List<TbContent> tbContents = tbContentMapper.selectByExample(null);
        return tbContents;
    }
    //廣告詳情增加
    @Override
    public void addAll(TbContent tbContent) {
        tbContentMapper.insertSelective(tbContent);
    }

    @Override
    public TbContent selectByID(Long id) {
        TbContent tbContent = tbContentMapper.selectByPrimaryKey(id);
        return tbContent;
    }

    @Override
    public void updateAll(TbContent tbContent) {
        tbContentMapper.updateByPrimaryKeySelective(tbContent);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        tbContentMapper.deleteBatch(ids);
    }
}
